<template>
  <view class="container">
		<nav-ber :title="'我的对账单'" :bgColor="'#f7f8ff'"></nav-ber>
<!-- 		<view class="province">
			<view class="mag_flex" @click="gotoStamenFun(1)">
				<view style="flex: 1;">
					<view class="tit_flex">
						<span class="font_w" style="font-size: 28rpx;">对账单发布通知</span>
						<span style="font-weight: 900;font-size: 28rpx;">已确认</span>
					</view>
					<view style="font-size: 25rpx;color: gray;margin-top: 10rpx;">
						发布时间 2022-06-30
					</view>
				</view>
				<view class="ico_bg">
					查看
				</view>
			</view> -->
			<u-empty style="margin-top: 100rpx;" v-if="!finAccounList.length" text="暂无数据" mode="list"></u-empty>
			<view class="mag_flex" v-for="(item, idnex) in finAccounList" :key="idnex" @tap="gotoStamenFun(item)">
				<view style="flex: 1;">
					<view class="tit_flex">
						<span class="font_w" style="font-size: 28rpx;">{{ item.month }}对账单</span>
						<span style="font-weight: 900;font-size: 28rpx;">{{ item.status != 3? '未确认' : '已确认' }}</span>
					</view>
					<view style="font-size: 25rpx;color: gray;margin-top: 10rpx;">
						发布时间： {{ item.sendTime }}
					</view>
				</view>
				<view class="ico_bg" @tap.stop="lookFun(item)">
					{{ item.status != 3? '确认' : '查看' }}
				</view>
			</view>
		</view>
  </view>
</template>
<script>
	import { finAccountCheckList, finAccountCheckconfirm } from '@/api/myStatement.js'
  export default {
    data() {
			return {
				keyword: '',
				ispro: '1',
				finAccounList: []
			}
    },
		onLoad() {
			this.finAccountCheckListFun()
		},
		methods: {
			lookFun(item) {
				if(item.status != 3){
					finAccountCheckconfirm({
						...item,
						status: 3
					}).then((res) => {
						uni.showToast({
							title: '已确认',
							icon: "none",
							duration: 2000,
							success: () => {
								setTimeout(() => {
									this.finAccountCheckListFun()
								}, 1000)
							}
						})
					})
				} else {
					uni.navigateTo({
						url: `/pages/personalCenter/statementDetails/index?id=${item.id}&type=1`
					})
				}
				// console.log(item)
				
			},
			finAccountCheckListFun() {
				finAccountCheckList({
					pageNum: 1,
					pageSize: 1000,
					// status: 2
					// mrId: ''
				}).then((res) => {
					console.log(res)
					this.finAccounList = res.rows
				})
			},
			gotoStamenFun(type) {
				uni.navigateTo({
					url: `/pages/personalCenter/statementDetails/index?id=${type.id}&type=${type.status == 3? 1 : 2}`
				})
			},
			proFun(val) {
				this.ispro = val
			}
		}
  }
</script>
<style lang="scss" scoped>
	.container {
		background-color: #f7f8ff;
		display: flex;
		flex-direction: column;
		height: 100vh;
		overflow: hidden;
	}
	.province {
		flex: 1;
		overflow: scroll;
		padding: 0 20rpx;
		margin-top: 20rpx;
	}
	.mag_flex {
		width: 100%;
		display: flex;
		align-items: center;
		background-color: #fff;
		padding: 20rpx;
		box-sizing: border-box;
		border-radius: 15rpx;
		margin-bottom: 25rpx;
	}
	.mag_flex:first-child {
		margin-top: 20rpx;
	}
	.ico_bg {
		background-color: rgb(3, 121, 255);
		border-radius: 100rpx;
		display: flex;
		margin-right: 10rpx;
		box-sizing: border-box;
		margin-left: 88px;
		color: #fff;
		padding: 10rpx 25rpx;
		box-sizing: border-box;
	}
	.font_w {
		font-weight: 900;
	}
	.tit_flex {
		width: 100%;
		display: flex;
		justify-content: space-between;;
	}
</style>
